package com.canxin.service.impl;

import java.util.List;

import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.canxin.entity.StudentsEntity;
import com.canxin.service.StudentServiceI;

@Service("studentService")
@Transactional
public class StudentServiceImpl extends CommonServiceImpl implements StudentServiceI {

	@Override
	public List<StudentsEntity> getAllStudents() {
		return super.findHql("from StudentsEntity order by id");
	}

	@Override
	public StudentsEntity getStudentsByStudentId(String studentId) {
		return (StudentsEntity)super.findHql("from StudentsEntity where id=?",studentId).get(0);
	}

	@Override
	public List<StudentsEntity> getStudentsByStudentName(String studentName) {
		if(studentName.equals("全部"))
		{
			 return super.findHql("from StudentsEntity");
		}
		studentName = "%"+studentName+"%";
		return super.findHql("from StudentsEntity where CHNAME like ?",studentName);
	}


}